package cn.tedu.service.impl;

import java.util.List;
import cn.tedu.dao.NewsTypeDao;
import cn.tedu.entity.*;
import cn.tedu.service.NewsTypeService;

public class NewsTypeServiceImpl implements NewsTypeService{

	NewsTypeDao ntdao = new NewsTypeDao();
	public List<NewsType> getAllNewsType() {
		return ntdao.getAllNewsType();
	}

	/*
	 * (non-Javadoc)
	 * @see cn.tedu.service.NewsTypeService#getAllNewsType()
	 
	public List<NewsType> getAllNewsType() {
		List<NewsType> listNewsType = new ArrayList<NewsType>();
		Connection conn = null;
		try {
			conn = DBUtil.getConnection();
			String sql = "select * from newsdynamic order by id desc";
			PreparedStatement ps =  conn.prepareStatement(sql);
			ResultSet rs = ps.executeQuery();
			while(rs.next()){
				NewsType newsType = new NewsType();
				newsType.setId(rs.getInt("id"));
				newsType.setType(rs.getString("type"));
				newsType.setImgURL(rs.getString("img_url"));
				newsType.setIntroduce(rs.getString("introduce"));
				newsType.setSkipURL(rs.getString("skip_url"));
				listNewsType.add(newsType);
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				conn.close();
			} catch (SQLException e) {
				e.printStackTrace();
			}
		}
		
		return listNewsType;
	}
*/
}
